(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 7.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[     51169,       1365]
NotebookOptionsPosition[     45839,       1167]
NotebookOutlinePosition[     46256,       1183]
CellTagsIndexPosition[     46213,       1180]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[TextData[{
 "New in: ",
 Cell["0.0", "HistoryData",
  CellTags->"New"],
 " | Modified in: ",
 Cell[" ", "HistoryData",
  CellTags->"Modified"],
 " | Obsolete in: ",
 Cell[" ", "HistoryData",
  CellTags->"Obsolete"],
 " | Excised in: ",
 Cell[" ", "HistoryData",
  CellTags->"Excised"]
}], "History",
 CellID->1247902091],

Cell[CellGroupData[{

Cell["Categorization", "CategorizationSection",
 CellID->1122911449],

Cell["Tutorial", "Categorization",
 CellLabel->"Entity Type",
 CellID->686433507],

Cell["MathMR", "Categorization",
 CellLabel->"Paclet Name",
 CellID->605800465],

Cell["MathMR`", "Categorization",
 CellLabel->"Context",
 CellID->468444828],

Cell["MathMR/tutorial/GenerateSpinBath", "Categorization",
 CellLabel->"URI"]
}, Closed]],

Cell[CellGroupData[{

Cell["Keywords", "KeywordsSection",
 CellID->1427428552],

Cell["XXXX", "Keywords",
 CellID->1251852827]
}, Closed]],

Cell[CellGroupData[{

Cell["Details", "DetailsSection",
 CellID->307771771],

Cell["XXXX", "Details",
 CellLabel->"Lead",
 CellID->218895918],

Cell["XXXX", "Details",
 CellLabel->"Developers",
 CellID->350963985],

Cell["XXXX", "Details",
 CellLabel->"Authors",
 CellID->795871300],

Cell["XXXX", "Details",
 CellLabel->"Feature Name",
 CellID->199739161],

Cell["XXXX", "Details",
 CellLabel->"QA",
 CellID->40625308],

Cell["XXXX", "Details",
 CellLabel->"DA",
 CellID->357121918],

Cell["XXXX", "Details",
 CellLabel->"Docs",
 CellID->35949532],

Cell["XXXX", "Details",
 CellLabel->"Features Page Notes",
 CellID->929432370],

Cell["XXXX", "Details",
 CellLabel->"Comments",
 CellID->240026365]
}, Closed]],

Cell[CellGroupData[{

Cell["GenerateSpinBath", "Title",
 CellID->509267359],

Cell["\<\
This tutorial gives a typical procedure to generate a random spin bath on \
diamond lattice\
\>", "Text",
 CellChangeTimes->{{3.498703465932872*^9, 3.498703515822258*^9}},
 CellID->1534169418],

Cell[BoxData[GridBox[{
   {
    ButtonBox["LoadLattice",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/LoadLattice"], Cell[
    "load a lattice", "TableText"]},
   {
    ButtonBox["GenerateBath",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/GenerateBath"], Cell[
    "generate random spins", "TableText"]},
   {
    ButtonBox["ExportBathFile",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/ExportBathFile"], Cell[
    "export spin coordinates", "TableText"]}
  }]], "DefinitionBox",
 CellChangeTimes->{{3.498703603550442*^9, 3.498703669641025*^9}, {
  3.49870465282346*^9, 3.49870467725284*^9}},
 CellID->2096742444],

Cell["Key functions to generate spin bath.", "Caption",
 CellChangeTimes->{{3.498703675592313*^9, 3.498703681678996*^9}},
 CellID->1891092685],

Cell[CellGroupData[{

Cell["Load the diamond lattice within a given range", "MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}},
 CellID->836781195],

Cell[BoxData[{
 RowBox[{
  RowBox[{"rx", "=", "20"}], ";", 
  RowBox[{"ry", "=", "20"}], ";", 
  RowBox[{"rz", "=", "20"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"LatticeCoord", "=", 
   RowBox[{"LoadLattice", "[", 
    RowBox[{"\"\<Diamond\>\"", ",", "$DiamondLatticeConst", ",", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
         RowBox[{"-", "rx"}], ",", "rx"}], "}"}], ",", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"-", "ry"}], ",", "ry"}], "}"}], ",", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"-", "rz"}], ",", "rz"}], "}"}]}], "}"}]}], "]"}]}], 
  ";"}]}], "Input",
 CellChangeTimes->{3.498703710284515*^9},
 CellLabel->"In[7]:=",
 CellID->2058623809]
}, Open  ]],

Cell[CellGroupData[{

Cell["Generate random sites which are occupied by nuclear spins", \
"MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}},
 CellID->146408444],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"seed", "=", "1"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"BathCoord", "=", 
   RowBox[{"GenerateBath", "[", 
    RowBox[{"LatticeCoord", ",", "$DiamondNatureAbundance", ",", "seed"}], 
    "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"NBath", "=", 
  RowBox[{"BathCoord", "//", "Length"}]}]}], "Input",
 CellChangeTimes->{
  3.498703710284515*^9, {3.498703765989239*^9, 3.4987037744353228`*^9}},
 CellLabel->"In[9]:=",
 CellID->348027072],

Cell[BoxData["6070"], "Output",
 CellChangeTimes->{3.498703778791185*^9, 3.498704646298139*^9, 
  3.498704904861633*^9},
 CellLabel->"Out[11]=",
 CellID->1262609439]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Select some of them with a given radius. ", "MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}, {3.498704683901407*^9, 3.498704693121651*^9}},
 CellID->289453039],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"SelDist", "=", "40."}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"SelBathCoord", "=", 
   RowBox[{"Select", "[", 
    RowBox[{"BathCoord", ",", 
     RowBox[{
      RowBox[{
       RowBox[{"Norm", "[", "#", "]"}], "<", "SelDist"}], "&"}]}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"ElementList", "=", 
   RowBox[{"Table", "[", 
    RowBox[{"\"\<C\>\"", ",", 
     RowBox[{"{", 
      RowBox[{"SelBathCoord", "//", "Length"}], "}"}]}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{"SelBathCoord", "//", "Length"}]}], "Input",
 CellChangeTimes->{3.49870388076823*^9},
 CellLabel->"In[12]:=",
 CellID->616121763],

Cell[BoxData["520"], "Output",
 CellChangeTimes->{3.498703881863859*^9, 3.498704646416448*^9, 
  3.498704904994582*^9},
 CellLabel->"Out[15]=",
 CellID->946679123]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Select some of them with a given radius", "MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}},
 CellID->1891780343],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"bathFileXYZ", "=", 
  RowBox[{"ExportBathFile", "[", 
   RowBox[{
    RowBox[{"$MRDocumentationPath", "<>", "\"\<data/ExampleBathSeed\>\"", "<>", 
     RowBox[{"ToString", "[", "seed", "]"}], "<>", "\"\<.xyz\>\""}], ",", 
    "SelBathCoord", ",", "ElementList"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.498703909209105*^9, 3.498703934044067*^9}, {
  3.498704348849454*^9, 3.498704366161635*^9}, {3.498704910251951*^9, 
  3.498704910347059*^9}},
 CellLabel->"In[17]:=",
 CellID->820671782],

Cell[BoxData["\<\"/home/nzhao/research/workspace/MathMRLib/MathMR/\
Documentation/English/data/ExampleBathSeed1.xyz\"\>"], "Output",
 CellChangeTimes->{{3.49870461890721*^9, 3.498704646524005*^9}, {
  3.498704905843237*^9, 3.498704910925643*^9}},
 CellLabel->"Out[17]=",
 CellID->378652307]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["You can check the bath by directly importing the .xyz file", \
"MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}, {3.498704831555979*^9, 3.498704846234509*^9}, {
  3.498705134534317*^9, 3.49870514065378*^9}},
 CellID->376630232],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Import", "[", 
  RowBox[{
  "$MRDocumentationPath", "<>", "\"\<data/ExampleBathSeed\>\"", "<>", 
   RowBox[{"ToString", "[", "seed", "]"}], "<>", "\"\<.xyz\>\""}], 
  "]"}]], "Input",
 CellChangeTimes->{{3.498704848054378*^9, 3.498704853295795*^9}, {
  3.498704913936877*^9, 3.498704914009145*^9}},
 CellLabel->"In[19]:=",
 CellID->1984436035],

Cell[BoxData[
 Graphics3DBox[
  {AbsoluteThickness[2], EdgeForm[None], Specularity[
    GrayLevel[1], 100], GraphicsComplex3DBox[CompressedData["
1:eJx1mj+OXEUQxgeTwBXI9ghkhC91tiLwAZAYMnA0CcGOhDQSQkIrGy3CltGy
a9asAWfONugDOOMKZD6CA3gzXb+v+qt5nmBa3a9fd1V11Vd/+p188c3nX95b
rVYfzX8fruJ3t51W4+9u2w7t6XrydjfZ/NPNZPOP3ttNH+zbf7/t7Sffx/iD
su4m5v3A/L7O7rsp2lbpY37vP9S82KfZvq9+DPoe+nunO6d32I91jN6TR+yn
caP35FFjv8pH7IucfP/dY+gQn/Y+/OX+kmfsF+ttWG9iPfa1/Zl3dw4dep99
TY7ID37n/Xxf9ELraf3Cd2/f/iS5GH85Dt+sI7lY//RBb1//LPpiH6cLeUjO
0uPy3kPWcz5OLybbf6az6nVvf4n3wi7QK+QCXdADH+pvJ9M79qGPXN7+VOR/
0Ww9fkfnfDHZ+Ao9e+rrpj5PlQ7bN88Xvvp7yA+9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ox[4, 34.], SphereBox[5, 34.], 
      SphereBox[6, 34.], SphereBox[7, 34.], SphereBox[8, 34.], 
      SphereBox[9, 34.], SphereBox[10, 34.], SphereBox[11, 34.], 
      SphereBox[12, 34.], SphereBox[13, 34.], SphereBox[14, 34.], 
      SphereBox[15, 34.], SphereBox[16, 34.], SphereBox[17, 34.], 
      SphereBox[18, 34.], SphereBox[19, 34.], SphereBox[20, 34.], 
      SphereBox[21, 34.], SphereBox[22, 34.], SphereBox[23, 34.], 
      SphereBox[24, 34.], SphereBox[25, 34.], SphereBox[26, 34.], 
      SphereBox[27, 34.], SphereBox[28, 34.], SphereBox[29, 34.], 
      SphereBox[30, 34.], SphereBox[31, 34.], SphereBox[32, 34.], 
      SphereBox[33, 34.], SphereBox[34, 34.], SphereBox[35, 34.], 
      SphereBox[36, 34.], SphereBox[37, 34.], SphereBox[38, 34.], 
      SphereBox[39, 34.], SphereBox[40, 34.], SphereBox[41, 34.], 
      SphereBox[42, 34.], SphereBox[43, 34.], SphereBox[44, 34.], 
      SphereBox[45, 34.], SphereBox[46, 34.], SphereBox[47, 34.], 
      SphereBox[48, 34.], SphereBox[49, 34.], SphereBox[50, 34.], 
      SphereBox[51, 34.], SphereBox[52, 34.], SphereBox[53, 34.], 
      SphereBox[54, 34.], SphereBox[55, 34.], SphereBox[56, 34.], 
      SphereBox[57, 34.], SphereBox[58, 34.], SphereBox[59, 34.], 
      SphereBox[60, 34.], SphereBox[61, 34.], SphereBox[62, 34.], 
      SphereBox[63, 34.], SphereBox[64, 34.], SphereBox[65, 34.], 
      SphereBox[66, 34.], SphereBox[67, 34.], SphereBox[68, 34.], 
      SphereBox[69, 34.], SphereBox[70, 34.], SphereBox[71, 34.], 
      SphereBox[72, 34.], SphereBox[73, 34.], SphereBox[74, 34.], 
      SphereBox[75, 34.], SphereBox[76, 34.], SphereBox[77, 34.], 
      SphereBox[78, 34.], SphereBox[79, 34.], SphereBox[80, 34.], 
      SphereBox[81, 34.], SphereBox[82, 34.], SphereBox[83, 34.], 
      SphereBox[84, 34.], SphereBox[85, 34.], SphereBox[86, 34.], 
      SphereBox[87, 34.], SphereBox[88, 34.], SphereBox[89, 34.], 
      SphereBox[90, 34.], SphereBox[91, 34.], SphereBox[92, 34.], 
      SphereBox[93, 34.], SphereBox[94, 34.], SphereBox[95, 34.], 
      SphereBox[96, 34.], SphereBox[97, 34.], SphereBox[98, 34.], 
      SphereBox[99, 34.], SphereBox[100, 34.], SphereBox[101, 34.], 
      SphereBox[102, 34.], SphereBox[103, 34.], SphereBox[104, 34.], 
      SphereBox[105, 34.], SphereBox[106, 34.], SphereBox[107, 34.], 
      SphereBox[108, 34.], SphereBox[109, 34.], SphereBox[110, 34.], 
      SphereBox[111, 34.], SphereBox[112, 34.], SphereBox[113, 34.], 
      SphereBox[114, 34.], SphereBox[115, 34.], SphereBox[116, 34.], 
      SphereBox[117, 34.], SphereBox[118, 34.], SphereBox[119, 34.], 
      SphereBox[120, 34.], SphereBox[121, 34.], SphereBox[122, 34.], 
      SphereBox[123, 34.], SphereBox[124, 34.], SphereBox[125, 34.], 
      SphereBox[126, 34.], SphereBox[127, 34.], SphereBox[128, 34.], 
      SphereBox[129, 34.], SphereBox[130, 34.], SphereBox[131, 34.], 
      SphereBox[132, 34.], SphereBox[133, 34.], SphereBox[134, 34.], 
      SphereBox[135, 34.], SphereBox[136, 34.], SphereBox[137, 34.], 
      SphereBox[138, 34.], SphereBox[139, 34.], SphereBox[140, 34.], 
      SphereBox[141, 34.], SphereBox[142, 34.], SphereBox[143, 34.], 
      SphereBox[144, 34.], SphereBox[145, 34.], SphereBox[146, 34.], 
      SphereBox[147, 34.], SphereBox[148, 34.], SphereBox[149, 34.], 
      SphereBox[150, 34.], SphereBox[151, 34.], SphereBox[152, 34.], 
      SphereBox[153, 34.], SphereBox[154, 34.], SphereBox[155, 34.], 
      SphereBox[156, 34.], SphereBox[157, 34.], SphereBox[158, 34.], 
      SphereBox[159, 34.], SphereBox[160, 34.], SphereBox[161, 34.], 
      SphereBox[162, 34.], SphereBox[163, 34.], SphereBox[164, 34.], 
      SphereBox[165, 34.], SphereBox[166, 34.], SphereBox[167, 34.], 
      SphereBox[168, 34.], SphereBox[169, 34.], SphereBox[170, 34.], 
      SphereBox[171, 34.], SphereBox[172, 34.], SphereBox[173, 34.], 
      SphereBox[174, 34.], SphereBox[175, 34.], SphereBox[176, 34.], 
      SphereBox[177, 34.], SphereBox[178, 34.], SphereBox[179, 34.], 
      SphereBox[180, 34.], SphereBox[181, 34.], SphereBox[182, 34.], 
      SphereBox[183, 34.], SphereBox[184, 34.], SphereBox[185, 34.], 
      SphereBox[186, 34.], SphereBox[187, 34.], SphereBox[188, 34.], 
      SphereBox[189, 34.], SphereBox[190, 34.], SphereBox[191, 34.], 
      SphereBox[192, 34.], SphereBox[193, 34.], SphereBox[194, 34.], 
      SphereBox[195, 34.], SphereBox[196, 34.], SphereBox[197, 34.], 
      SphereBox[198, 34.], SphereBox[199, 34.], SphereBox[200, 34.], 
      SphereBox[201, 34.], SphereBox[202, 34.], SphereBox[203, 34.], 
      SphereBox[204, 34.], SphereBox[205, 34.], SphereBox[206, 34.], 
      SphereBox[207, 34.], SphereBox[208, 34.], SphereBox[209, 34.], 
      SphereBox[210, 34.], SphereBox[211, 34.], SphereBox[212, 34.], 
      SphereBox[213, 34.], SphereBox[214, 34.], SphereBox[215, 34.], 
      SphereBox[216, 34.], SphereBox[217, 34.], SphereBox[218, 34.], 
      SphereBox[219, 34.], SphereBox[220, 34.], SphereBox[221, 34.], 
      SphereBox[222, 34.], SphereBox[223, 34.], SphereBox[224, 34.], 
      SphereBox[225, 34.], SphereBox[226, 34.], SphereBox[227, 34.], 
      SphereBox[228, 34.], SphereBox[229, 34.], SphereBox[230, 34.], 
      SphereBox[231, 34.], SphereBox[232, 34.], SphereBox[233, 34.], 
      SphereBox[234, 34.], SphereBox[235, 34.], SphereBox[236, 34.], 
      SphereBox[237, 34.], SphereBox[238, 34.], SphereBox[239, 34.], 
      SphereBox[240, 34.], SphereBox[241, 34.], SphereBox[242, 34.], 
      SphereBox[243, 34.], SphereBox[244, 34.], SphereBox[245, 34.], 
      SphereBox[246, 34.], SphereBox[247, 34.], SphereBox[248, 34.], 
      SphereBox[249, 34.], SphereBox[250, 34.], SphereBox[251, 34.], 
      SphereBox[252, 34.], SphereBox[253, 34.], SphereBox[254, 34.], 
      SphereBox[255, 34.], SphereBox[256, 34.], SphereBox[257, 34.], 
      SphereBox[258, 34.], SphereBox[259, 34.], SphereBox[260, 34.], 
      SphereBox[261, 34.], SphereBox[262, 34.], SphereBox[263, 34.], 
      SphereBox[264, 34.], SphereBox[265, 34.], SphereBox[266, 34.], 
      SphereBox[267, 34.], SphereBox[268, 34.], SphereBox[269, 34.], 
      SphereBox[270, 34.], SphereBox[271, 34.], SphereBox[272, 34.], 
      SphereBox[273, 34.], SphereBox[274, 34.], SphereBox[275, 34.], 
      SphereBox[276, 34.], SphereBox[277, 34.], SphereBox[278, 34.], 
      SphereBox[279, 34.], SphereBox[280, 34.], SphereBox[281, 34.], 
      SphereBox[282, 34.], SphereBox[283, 34.], SphereBox[284, 34.], 
      SphereBox[285, 34.], SphereBox[286, 34.], SphereBox[287, 34.], 
      SphereBox[288, 34.], SphereBox[289, 34.], SphereBox[290, 34.], 
      SphereBox[291, 34.], SphereBox[292, 34.], SphereBox[293, 34.], 
      SphereBox[294, 34.], SphereBox[295, 34.], SphereBox[296, 34.], 
      SphereBox[297, 34.], SphereBox[298, 34.], SphereBox[299, 34.], 
      SphereBox[300, 34.], SphereBox[301, 34.], SphereBox[302, 34.], 
      SphereBox[303, 34.], SphereBox[304, 34.], SphereBox[305, 34.], 
      SphereBox[306, 34.], SphereBox[307, 34.], SphereBox[308, 34.], 
      SphereBox[309, 34.], SphereBox[310, 34.], SphereBox[311, 34.], 
      SphereBox[312, 34.], SphereBox[313, 34.], SphereBox[314, 34.], 
      SphereBox[315, 34.], SphereBox[316, 34.], SphereBox[317, 34.], 
      SphereBox[318, 34.], SphereBox[319, 34.], SphereBox[320, 34.], 
      SphereBox[321, 34.], SphereBox[322, 34.], SphereBox[323, 34.], 
      SphereBox[324, 34.], SphereBox[325, 34.], SphereBox[326, 34.], 
      SphereBox[327, 34.], SphereBox[328, 34.], SphereBox[329, 34.], 
      SphereBox[330, 34.], SphereBox[331, 34.], SphereBox[332, 34.], 
      SphereBox[333, 34.], SphereBox[334, 34.], SphereBox[335, 34.], 
      SphereBox[336, 34.], SphereBox[337, 34.], SphereBox[338, 34.], 
      SphereBox[339, 34.], SphereBox[340, 34.], SphereBox[341, 34.], 
      SphereBox[342, 34.], SphereBox[343, 34.], SphereBox[344, 34.], 
      SphereBox[345, 34.], SphereBox[346, 34.], SphereBox[347, 34.], 
      SphereBox[348, 34.], SphereBox[349, 34.], SphereBox[350, 34.], 
      SphereBox[351, 34.], SphereBox[352, 34.], SphereBox[353, 34.], 
      SphereBox[354, 34.], SphereBox[355, 34.], SphereBox[356, 34.], 
      SphereBox[357, 34.], SphereBox[358, 34.], SphereBox[359, 34.], 
      SphereBox[360, 34.], SphereBox[361, 34.], SphereBox[362, 34.], 
      SphereBox[363, 34.], SphereBox[364, 34.], SphereBox[365, 34.], 
      SphereBox[366, 34.], SphereBox[367, 34.], SphereBox[368, 34.], 
      SphereBox[369, 34.], SphereBox[370, 34.], SphereBox[371, 34.], 
      SphereBox[372, 34.], SphereBox[373, 34.], SphereBox[374, 34.], 
      SphereBox[375, 34.], SphereBox[376, 34.], SphereBox[377, 34.], 
      SphereBox[378, 34.], SphereBox[379, 34.], SphereBox[380, 34.], 
      SphereBox[381, 34.], SphereBox[382, 34.], SphereBox[383, 34.], 
      SphereBox[384, 34.], SphereBox[385, 34.], SphereBox[386, 34.], 
      SphereBox[387, 34.], SphereBox[388, 34.], SphereBox[389, 34.], 
      SphereBox[390, 34.], SphereBox[391, 34.], SphereBox[392, 34.], 
      SphereBox[393, 34.], SphereBox[394, 34.], SphereBox[395, 34.], 
      SphereBox[396, 34.], SphereBox[397, 34.], SphereBox[398, 34.], 
      SphereBox[399, 34.], SphereBox[400, 34.], SphereBox[401, 34.], 
      SphereBox[402, 34.], SphereBox[403, 34.], SphereBox[404, 34.], 
      SphereBox[405, 34.], SphereBox[406, 34.], SphereBox[407, 34.], 
      SphereBox[408, 34.], SphereBox[409, 34.], SphereBox[410, 34.], 
      SphereBox[411, 34.], SphereBox[412, 34.], SphereBox[413, 34.], 
      SphereBox[414, 34.], SphereBox[415, 34.], SphereBox[416, 34.], 
      SphereBox[417, 34.], SphereBox[418, 34.], SphereBox[419, 34.], 
      SphereBox[420, 34.], SphereBox[421, 34.], SphereBox[422, 34.], 
      SphereBox[423, 34.], SphereBox[424, 34.], SphereBox[425, 34.], 
      SphereBox[426, 34.], SphereBox[427, 34.], SphereBox[428, 34.], 
      SphereBox[429, 34.], SphereBox[430, 34.], SphereBox[431, 34.], 
      SphereBox[432, 34.], SphereBox[433, 34.], SphereBox[434, 34.], 
      SphereBox[435, 34.], SphereBox[436, 34.], SphereBox[437, 34.], 
      SphereBox[438, 34.], SphereBox[439, 34.], SphereBox[440, 34.], 
      SphereBox[441, 34.], SphereBox[442, 34.], SphereBox[443, 34.], 
      SphereBox[444, 34.], SphereBox[445, 34.], SphereBox[446, 34.], 
      SphereBox[447, 34.], SphereBox[448, 34.], SphereBox[449, 34.], 
      SphereBox[450, 34.], SphereBox[451, 34.], SphereBox[452, 34.], 
      SphereBox[453, 34.], SphereBox[454, 34.], SphereBox[455, 34.], 
      SphereBox[456, 34.], SphereBox[457, 34.], SphereBox[458, 34.], 
      SphereBox[459, 34.], SphereBox[460, 34.], SphereBox[461, 34.], 
      SphereBox[462, 34.], SphereBox[463, 34.], SphereBox[464, 34.], 
      SphereBox[465, 34.], SphereBox[466, 34.], SphereBox[467, 34.], 
      SphereBox[468, 34.], SphereBox[469, 34.], SphereBox[470, 34.], 
      SphereBox[471, 34.], SphereBox[472, 34.], SphereBox[473, 34.], 
      SphereBox[474, 34.], SphereBox[475, 34.], SphereBox[476, 34.], 
      SphereBox[477, 34.], SphereBox[478, 34.], SphereBox[479, 34.], 
      SphereBox[480, 34.], SphereBox[481, 34.], SphereBox[482, 34.], 
      SphereBox[483, 34.], SphereBox[484, 34.], SphereBox[485, 34.], 
      SphereBox[486, 34.], SphereBox[487, 34.], SphereBox[488, 34.], 
      SphereBox[489, 34.], SphereBox[490, 34.], SphereBox[491, 34.], 
      SphereBox[492, 34.], SphereBox[493, 34.], SphereBox[494, 34.], 
      SphereBox[495, 34.], SphereBox[496, 34.], SphereBox[497, 34.], 
      SphereBox[498, 34.], SphereBox[499, 34.], SphereBox[500, 34.], 
      SphereBox[501, 34.], SphereBox[502, 34.], SphereBox[503, 34.], 
      SphereBox[504, 34.], SphereBox[505, 34.], SphereBox[506, 34.], 
      SphereBox[507, 34.], SphereBox[508, 34.], SphereBox[509, 34.], 
      SphereBox[510, 34.], SphereBox[511, 34.], SphereBox[512, 34.], 
      SphereBox[513, 34.], SphereBox[514, 34.], SphereBox[515, 34.], 
      SphereBox[516, 34.], SphereBox[517, 34.], SphereBox[518, 34.], 
      SphereBox[519, 34.], SphereBox[520, 34.]}, 
     {RGBColor[0.4, 0.4, 0.4], CylinderBox[{74, 88}, 15.], 
      CylinderBox[{78, 81}, 15.], CylinderBox[{203, 223}, 15.], 
      CylinderBox[{214, 235}, 15.], CylinderBox[{217, 239}, 15.], 
      CylinderBox[{335, 371}, 15.], CylinderBox[{457, 465}, 15.]}}]},
  Boxed->False,
  ImageSize->{303., 347.},
  Lighting->"Neutral",
  ViewPoint->{-2.3146567936563014`, -0.6563585354063105, -2.374017144120912},
  ViewVertical->{-0.156051681414315, 0.0009649407119338657, 
   1.0346504520463629`}]], "Output",
 CellChangeTimes->{
  3.498704853958673*^9, {3.498704914921088*^9, 3.498704928171122*^9}},
 CellLabel->"Out[19]=",
 CellID->1518895922]
}, Open  ]]
}, Open  ]],

Cell[BoxData[GridBox[{
   {
    ButtonBox["GenerateLinkList",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/GenerateLinkList"], 
    RowBox[{"generate", " ", "a", " ", "link", " ", "list"}]},
   {
    ButtonBox["ConnectAbsorb",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/ConnectAbsorb"], 
    RowBox[{
    "test", " ", "and", " ", "absorb", " ", "linked", " ", "elements"}]},
   {
    ButtonBox["CoarseGrainClusters",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/CoarseGrainClusters"], 
    RowBox[{
    "divide", " ", "the", " ", "bath", " ", "into", " ", "coarse", " ", 
     "grained", " ", "clusters", " "}]}
  }]], "DefinitionBox",
 CellChangeTimes->{{3.498703603550442*^9, 3.498703669641025*^9}, {
  3.49870465282346*^9, 3.49870467725284*^9}, {3.498705070880588*^9, 
  3.49870510861055*^9}, {3.498705169622972*^9, 3.49870529662042*^9}},
 CellID->373625588],

Cell["functions related to the pre-clustering of the bath spins", "Caption",
 CellChangeTimes->{{3.498703675592313*^9, 3.498703681678996*^9}, {
  3.498705302801865*^9, 3.498705331949011*^9}},
 CellID->1033699251],

Cell[CellGroupData[{

Cell["\<\
Generate link list. A link list consists of pairwise spin indices which are \
connected.\
\>", "MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}, {3.498704831555979*^9, 3.498704846234509*^9}, {
  3.498705134534317*^9, 3.49870514065378*^9}, {3.498705350356625*^9, 
  3.498705358547752*^9}, {3.49870542644089*^9, 3.498705459143221*^9}},
 CellID->1267183024],

Cell[BoxData[
 RowBox[{
  RowBox[{"LinkList", "=", 
   RowBox[{"GenerateLinkList", "[", 
    RowBox[{"SelBathCoord", ",", "6.0"}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.498704848054378*^9, 3.498704853295795*^9}, {
  3.498704913936877*^9, 3.498704914009145*^9}, {3.498705363208177*^9, 
  3.498705418807378*^9}},
 CellLabel->"In[22]:=",
 CellID->646597982]
}, Open  ]],

Cell[CellGroupData[{

Cell["\<\
In the following we generate a set of coarse grained clusters (CGS). The \
subsets in CGC are not connected, while in a single subset, all the spins are \
connected forming a \"net\".\
\>", "MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}, {3.498704831555979*^9, 3.498704846234509*^9}, {
  3.498705134534317*^9, 3.49870514065378*^9}, {3.498705350356625*^9, 
  3.498705358547752*^9}, {3.49870542644089*^9, 3.498705459143221*^9}, {
  3.49870553819628*^9, 3.498705666109901*^9}},
 CellID->1391648720],

Cell[BoxData[
 RowBox[{
  RowBox[{"CGC", "=", 
   RowBox[{"CoarseGrainClusters", "[", 
    RowBox[{"LinkList", ",", "SelBathCoord"}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.498705484514812*^9, 3.498705525082408*^9}},
 CellLabel->"In[24]:=",
 CellID->1801583673],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Tally", "[", 
  RowBox[{"Length", "/@", "CGC"}], "]"}]], "Input",
 CellChangeTimes->{{3.498705685063326*^9, 3.498705702471645*^9}},
 CellLabel->"In[25]:=",
 CellID->1593503505],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"1", ",", "127"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"2", ",", "39"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"3", ",", "23"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"4", ",", "5"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"5", ",", "7"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"6", ",", "5"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"7", ",", "6"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"8", ",", "1"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"9", ",", "2"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"10", ",", "1"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"12", ",", "1"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"13", ",", "3"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"15", ",", "1"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"17", ",", "1"}], "}"}]}], "}"}]], "Output",
 CellChangeTimes->{3.498705702719337*^9},
 CellLabel->"Out[25]=",
 CellID->1936366222]
}, Open  ]]
}, Open  ]],

Cell[BoxData[GridBox[{
   {
    ButtonBox["LatticeNeighbor",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/LatticeNeighbor"], 
    RowBox[{"Analyze", " ", "the", " ", "lattice", " ", "structure"}]},
   {
    ButtonBox["BathDistAnalyze",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/BathDistAnalyze"], 
    RowBox[{"Analyze", " ", "the", " ", "bath", " ", "connection"}]},
   {
    ButtonBox["GetCoherentCluster",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/GetCoherentCluster"], 
    RowBox[{
    "Get", " ", "information", " ", "of", " ", "coherent", " ", 
     "clusters"}]},
   {
    ButtonBox["Spin2Info",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/Spin2Info"], 
    RowBox[{
     RowBox[{"Show", " ", "the", " ", "2"}], "-", 
     RowBox[{"spin", " ", "cluster", " ", "information"}]}]},
   {
    ButtonBox["Spin3Info",
     BaseStyle->"Link",
     ButtonData->"paclet:MathMR/ref/Spin3Info"], 
    RowBox[{
     RowBox[{"Show", " ", "the", " ", "3"}], "-", 
     RowBox[{"spin", " ", "cluster", " ", "information"}]}]}
  }]], "DefinitionBox",
 CellChangeTimes->{{3.498703603550442*^9, 3.498703669641025*^9}, {
  3.49870465282346*^9, 3.49870467725284*^9}, {3.498705070880588*^9, 
  3.49870510861055*^9}, {3.498705169622972*^9, 3.49870529662042*^9}, {
  3.498705839312695*^9, 3.498705917054589*^9}, {3.498705948203758*^9, 
  3.49870594837409*^9}, {3.498706886299448*^9, 3.498706928298526*^9}, {
  3.498707043310828*^9, 3.498707046950428*^9}},
 CellID->1056896391],

Cell["functions for further analyzing the bath structures", "Caption",
 CellChangeTimes->{{3.498703675592313*^9, 3.498703681678996*^9}, {
  3.498705302801865*^9, 3.498705331949011*^9}, {3.498705924110422*^9, 
  3.498705935761754*^9}},
 CellID->636082276],

Cell[CellGroupData[{

Cell["Here we show the neighbor distance of the diamond structure", \
"MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}, {3.498704831555979*^9, 3.498704846234509*^9}, {
  3.498705134534317*^9, 3.49870514065378*^9}, {3.498705350356625*^9, 
  3.498705358547752*^9}, {3.49870542644089*^9, 3.498705459143221*^9}, {
  3.498705973968889*^9, 3.498705992143074*^9}},
 CellID->901871749],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"TableForm", "[", 
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{"NeighborList", "=", 
      RowBox[{"LatticeNeighbor", "[", 
       RowBox[{"\"\<Diamond\>\"", ",", "$DiamondLatticeConst", ",", "2"}], 
       "]"}]}], ")"}], "//", "Transpose"}], ",", 
   RowBox[{"TableAlignments", "\[Rule]", "Center"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.498704848054378*^9, 3.498704853295795*^9}, {
   3.498704913936877*^9, 3.498704914009145*^9}, {3.498705363208177*^9, 
   3.498705418807378*^9}, 3.498705966113517*^9, {3.498706098891703*^9, 
   3.498706109029445*^9}},
 CellLabel->"In[28]:=",
 CellID->2136589945],

Cell[BoxData[
 TagBox[GridBox[{
    {"0", "1.5458553457552229`", "2.524371208835974`", "2.960087625392194`", 
     "3.57`", "3.890317307110051`", "4.372339190867972`", 
     "4.637566037265668`", "5.048742417671949`", "5.280101206416407`", 
     "5.644665623400557`", "5.852513882939535`", "6.1834213830208915`", 
     "6.373724872474494`", "6.678858435391485`", "6.855422579972732`"},
    {"1", "4", "12", "12", "6", "12", "24", "16", "12", "24", "24", "12", "8",
      "24", "48", "36"}
   },
   GridBoxAlignment->{
    "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Center}}, 
     "RowsIndexed" -> {}},
   GridBoxSpacings->{"Columns" -> {
       Offset[0.27999999999999997`], {
        Offset[0.7]}, 
       Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
       Offset[0.2], {
        Offset[0.4]}, 
       Offset[0.2]}, "RowsIndexed" -> {}}],
  Function[BoxForm`e$, 
   TableForm[BoxForm`e$, TableAlignments -> Center]]]], "Output",
 CellChangeTimes->{3.498705968297178*^9, 3.498706110126719*^9},
 CellLabel->"Out[28]//TableForm=",
 CellID->484417948]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\<\
Here is some statistics of the spin pairs at certain distances.\
\>", "MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}, {3.498704831555979*^9, 3.498704846234509*^9}, {
  3.498705134534317*^9, 3.49870514065378*^9}, {3.498705350356625*^9, 
  3.498705358547752*^9}, {3.49870542644089*^9, 3.498705459143221*^9}, {
  3.498705973968889*^9, 3.498705992143074*^9}, {3.498706335961411*^9, 
  3.498706359430531*^9}},
 CellID->1039735924],

Cell[BoxData[{
 RowBox[{
  RowBox[{"dist", "=", 
   RowBox[{
    RowBox[{
     RowBox[{"Norm", "[", 
      RowBox[{"Differences", "[", 
       RowBox[{
       "SelBathCoord", "\[LeftDoubleBracket]", "#", "\[RightDoubleBracket]"}],
        "]"}], "]"}], "&"}], "/@", "LinkList"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"LinkInfo", "=", 
   RowBox[{"MapThread", "[", 
    RowBox[{
     RowBox[{
      RowBox[{"Append", "[", 
       RowBox[{"#1", ",", "#2"}], "]"}], "&"}], ",", 
     RowBox[{"{", 
      RowBox[{"LinkList", ",", "dist"}], "}"}]}], "]"}]}], ";"}]}], "Input",
 CellChangeTimes->{
  3.498706243033858*^9, {3.498706294821098*^9, 3.498706306310256*^9}},
 CellLabel->"In[34]:=",
 CellID->1502533949],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"BathDistAnalyze", "[", 
  RowBox[{"LinkInfo", ",", "SelBathCoord", ",", "NeighborList"}], 
  "]"}]], "Input",
 CellChangeTimes->{{3.498706128463279*^9, 3.498706137997611*^9}, 
   3.498706315880561*^9},
 CellLabel->"In[37]:=",
 CellID->1929637448],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"1", ",", "1.545855345755221`", ",", "7"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"2", ",", "2.524371208835972`", ",", "25"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"3", ",", "2.9600876253921924`", ",", "30"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"4", ",", "3.5699999999999967`", ",", "19"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"5", ",", "3.8903173071100476`", ",", "37"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"6", ",", "4.3723391908679705`", ",", "56"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"7", ",", "4.637566037265667`", ",", "40"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"8", ",", "5.0487424176719475`", ",", "26"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"9", ",", "5.280101206416405`", ",", "56"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"10", ",", "5.644665623400554`", ",", "47"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"11", ",", "5.852513882939534`", ",", "32"}], "}"}]}], 
  "}"}]], "Output",
 CellChangeTimes->{
  3.498706139850004*^9, {3.498706309980433*^9, 3.498706316357414*^9}},
 CellLabel->"Out[37]=",
 CellID->986531623]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Get the 2-spin and 3-spin coherent clusters in diamond", "MathCaption",
 CellChangeTimes->{{3.498703715798243*^9, 3.498703735412959*^9}, {
  3.498703787922936*^9, 3.498703806657458*^9}, {3.498703859423816*^9, 
  3.49870387543922*^9}, {3.498704831555979*^9, 3.498704846234509*^9}, {
  3.498705134534317*^9, 3.49870514065378*^9}, {3.498705350356625*^9, 
  3.498705358547752*^9}, {3.49870542644089*^9, 3.498705459143221*^9}, {
  3.498705973968889*^9, 3.498705992143074*^9}, {3.498706335961411*^9, 
  3.498706359430531*^9}, {3.498706793292045*^9, 3.498706808402848*^9}},
 CellID->1489838555],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"{", 
    RowBox[{"Spin2Idx", ",", "Spin3Idx"}], "}"}], "=", 
   RowBox[{"GetCoherentCluster", "[", 
    RowBox[{"LinkInfo", ",", "SelBathCoord", ",", "NeighborList", ",", "1"}], 
    "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"Length", "/@", 
  RowBox[{"{", 
   RowBox[{"Spin2Idx", ",", "Spin3Idx"}], "}"}]}]}], "Input",
 CellChangeTimes->{{3.498706818425032*^9, 3.498706829017314*^9}, {
  3.498706936752607*^9, 3.498706945237191*^9}},
 CellLabel->"In[43]:=",
 CellID->1204751577],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"7", ",", "0"}], "}"}]], "Output",
 CellChangeTimes->{{3.498706942769847*^9, 3.498706945638052*^9}},
 CellLabel->"Out[44]=",
 CellID->1859847773]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"Spin2Info", "[", 
    RowBox[{"Spin2Idx", ",", "SelBathCoord"}], "]"}], "\[LeftDoubleBracket]", 
   
   RowBox[{";;", "5"}], "\[RightDoubleBracket]"}], "//", 
  "TableForm"}]], "Input",
 CellChangeTimes->{{3.49870683207326*^9, 3.498706850926498*^9}, {
  3.498706916789031*^9, 3.498706917557929*^9}},
 CellLabel->"In[39]:=",
 CellID->1337784427],

Cell[BoxData[
 InterpretationBox[GridBox[{
    {GridBox[{
       {"81"},
       {"78"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], GridBox[{
       {
        RowBox[{"-", "17.849999999999998`"}], 
        RowBox[{"-", "1.785`"}], 
        RowBox[{"-", "12.495`"}]},
       {
        RowBox[{"-", "16.9575`"}], 
        RowBox[{"-", "2.6774999999999998`"}], 
        RowBox[{"-", "13.3875`"}]}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], "1.545855345755222`", 
     "21.802406798046402`"},
    {GridBox[{
       {"88"},
       {"74"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], GridBox[{
       {
        RowBox[{"-", "9.817499999999999`"}], 
        RowBox[{"-", "0.8925`"}], "20.5275`"},
       {
        RowBox[{"-", "8.924999999999999`"}], "0", "19.634999999999998`"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], "1.5458553457552242`", 
     "22.16474829966494`"},
    {GridBox[{
       {"223"},
       {"203"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], GridBox[{
       {"10.709999999999999`", "16.064999999999998`", "23.205`"},
       {"11.6025`", "15.1725`", "22.3125`"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], "1.545855345755221`", 
     "29.771932540355856`"},
    {GridBox[{
       {"235"},
       {"214"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], GridBox[{
       {
        RowBox[{"-", "6.2475`"}], "25.8825`", "15.1725`"},
       {
        RowBox[{"-", "7.14`"}], "24.99`", "14.28`"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], "1.5458553457552242`", 
     "30.144179242226848`"},
    {GridBox[{
       {"239"},
       {"217"}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], GridBox[{
       {"24.0975`", "18.7425`", 
        RowBox[{"-", "4.4624999999999995`"}]},
       {"23.205`", "17.849999999999998`", 
        RowBox[{"-", "5.3549999999999995`"}]}
      },
      GridBoxAlignment->{
       "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.7]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.1]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}], "1.545855345755225`", 
     "30.302313726636452`"}
   },
   GridBoxAlignment->{
    "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, 
     "RowsIndexed" -> {}},
   GridBoxSpacings->{"Columns" -> {
       Offset[0.27999999999999997`], {
        Offset[2.0999999999999996`]}, 
       Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
       Offset[0.2], {
        Offset[0.4]}, 
       Offset[0.2]}, "RowsIndexed" -> {}}],
  TableForm[{{{81, 
     78}, {{-17.849999999999998`, -1.785, -12.495}, {-16.9575, \
-2.6774999999999998`, -13.3875}}, 1.545855345755222, 21.802406798046402`}, {{
     88, 74}, {{-9.817499999999999, -0.8925, 
      20.5275}, {-8.924999999999999, 0, 19.634999999999998`}}, 
     1.5458553457552242`, 22.16474829966494}, {{223, 203}, {{
     10.709999999999999`, 16.064999999999998`, 23.205}, {11.6025, 15.1725, 
     22.3125}}, 1.545855345755221, 29.771932540355856`}, {{235, 
     214}, {{-6.2475, 25.8825, 15.1725}, {-7.14, 24.99, 14.28}}, 
     1.5458553457552242`, 30.144179242226848`}, {{239, 217}, {{24.0975, 
     18.7425, -4.4624999999999995`}, {23.205, 
     17.849999999999998`, -5.3549999999999995`}}, 1.545855345755225, 
     30.302313726636452`}}]]], "Output",
 CellChangeTimes->{3.498706854690108*^9},
 CellLabel->"Out[39]//TableForm=",
 CellID->630000837]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Spin3Info", "[", 
   RowBox[{"Spin3Idx", ",", "SelBathCoord"}], "]"}], "//", 
  "TableForm"}]], "Input",
 CellChangeTimes->{{3.498706859746182*^9, 3.498706866620213*^9}},
 CellLabel->"In[40]:=",
 CellID->2047027162],

Cell[BoxData[
 TagBox[
  RowBox[{"{", "}"}],
  Function[BoxForm`e$, 
   TableForm[BoxForm`e$]]]], "Output",
 CellChangeTimes->{3.498706867139262*^9},
 CellLabel->"Out[40]//TableForm=",
 CellID->191610120]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["More About", "TutorialMoreAboutSection",
 CellID->23220180],

Cell[TextData[ButtonBox["Magnetic Resonance",
 BaseStyle->"Link",
 ButtonData->"paclet:MathMR/guide/Magnetic Resonance"]], "TutorialMoreAbout",
 CellChangeTimes->{{3.49870479349109*^9, 3.498704806170119*^9}},
 CellID->238287387]
}, Open  ]],

Cell[CellGroupData[{

Cell["Related Tutorials", "RelatedTutorialsSection",
 CellChangeTimes->{3.498704806774788*^9},
 CellID->415694126],

Cell["XXXX", "RelatedTutorials",
 CellID->806871991]
}, Open  ]],

Cell[CellGroupData[{

Cell["Related Wolfram Education Group Courses", "TutorialRelatedLinksSection",
 CellID->415694148],

Cell["XXXX", "TutorialRelatedLinks",
 CellID->415694149]
}, Open  ]]
}, Open  ]]
},
WindowSize->{1584, 816},
WindowMargins->{{0, Automatic}, {Automatic, 25}},
FrontEndVersion->"7.0 for Linux x86 (32-bit) (February 25, 2009)",
StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "TutorialPageStyles.nb", 
  CharacterEncoding -> "iso8859-1"]
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[545, 20, 325, 14, 26, "History",
 CellID->1247902091],
Cell[CellGroupData[{
Cell[895, 38, 68, 1, 30, "CategorizationSection",
 CellID->1122911449],
Cell[966, 41, 81, 2, 70, "Categorization",
 CellID->686433507],
Cell[1050, 45, 79, 2, 70, "Categorization",
 CellID->605800465],
Cell[1132, 49, 76, 2, 70, "Categorization",
 CellID->468444828],
Cell[1211, 53, 77, 1, 70, "Categorization"]
}, Closed]],
Cell[CellGroupData[{
Cell[1325, 59, 56, 1, 20, "KeywordsSection",
 CellID->1427428552],
Cell[1384, 62, 45, 1, 70, "Keywords",
 CellID->1251852827]
}, Closed]],
Cell[CellGroupData[{
Cell[1466, 68, 53, 1, 20, "DetailsSection",
 CellID->307771771],
Cell[1522, 71, 63, 2, 70, "Details",
 CellID->218895918],
Cell[1588, 75, 69, 2, 70, "Details",
 CellID->350963985],
Cell[1660, 79, 66, 2, 70, "Details",
 CellID->795871300],
Cell[1729, 83, 71, 2, 70, "Details",
 CellID->199739161],
Cell[1803, 87, 60, 2, 70, "Details",
 CellID->40625308],
Cell[1866, 91, 61, 2, 70, "Details",
 CellID->357121918],
Cell[1930, 95, 62, 2, 70, "Details",
 CellID->35949532],
Cell[1995, 99, 78, 2, 70, "Details",
 CellID->929432370],
Cell[2076, 103, 67, 2, 70, "Details",
 CellID->240026365]
}, Closed]],
Cell[CellGroupData[{
Cell[2180, 110, 53, 1, 106, "Title",
 CellID->509267359],
Cell[2236, 113, 202, 5, 24, "Text",
 CellID->1534169418],
Cell[2441, 120, 659, 19, 94, "DefinitionBox",
 CellID->2096742444],
Cell[3103, 141, 142, 2, 30, "Caption",
 CellID->1891092685],
Cell[CellGroupData[{
Cell[3270, 147, 154, 2, 40, "MathCaption",
 CellID->836781195],
Cell[3427, 151, 731, 23, 73, "Input",
 CellID->2058623809]
}, Open  ]],
Cell[CellGroupData[{
Cell[4195, 179, 217, 4, 40, "MathCaption",
 CellID->146408444],
Cell[CellGroupData[{
Cell[4437, 187, 491, 13, 73, "Input",
 CellID->348027072],
Cell[4931, 202, 165, 4, 26, "Output",
 CellID->1262609439]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[5145, 212, 293, 4, 40, "MathCaption",
 CellID->289453039],
Cell[CellGroupData[{
Cell[5463, 220, 685, 21, 95, "Input",
 CellID->616121763],
Cell[6151, 243, 163, 4, 26, "Output",
 CellID->946679123]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[6363, 253, 246, 4, 40, "MathCaption",
 CellID->1891780343],
Cell[CellGroupData[{
Cell[6634, 261, 514, 11, 73, "Input",
 CellID->820671782],
Cell[7151, 274, 290, 5, 47, "Output",
 CellID->378652307]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[7490, 285, 360, 6, 40, "MathCaption",
 CellID->376630232],
Cell[CellGroupData[{
Cell[7875, 295, 367, 9, 51, "Input",
 CellID->1984436035],
Cell[8245, 306, 16477, 252, 357, "Output",
 CellID->1518895922]
}, Open  ]]
}, Open  ]],
Cell[24749, 562, 908, 23, 94, "DefinitionBox",
 CellID->373625588],
Cell[25660, 587, 212, 3, 30, "Caption",
 CellID->1033699251],
Cell[CellGroupData[{
Cell[25897, 594, 491, 9, 57, "MathCaption",
 CellID->1267183024],
Cell[26391, 605, 364, 9, 28, "Input",
 CellID->646597982]
}, Open  ]],
Cell[CellGroupData[{
Cell[26792, 619, 634, 11, 74, "MathCaption",
 CellID->1391648720],
Cell[27429, 632, 270, 7, 28, "Input",
 CellID->1801583673],
Cell[CellGroupData[{
Cell[27724, 643, 200, 5, 28, "Input",
 CellID->1593503505],
Cell[27927, 650, 975, 33, 47, "Output",
 CellID->1936366222]
}, Open  ]]
}, Open  ]],
Cell[28929, 687, 1528, 39, 144, "DefinitionBox",
 CellID->1056896391],
Cell[30460, 728, 254, 4, 30, "Caption",
 CellID->636082276],
Cell[CellGroupData[{
Cell[30739, 736, 504, 8, 40, "MathCaption",
 CellID->901871749],
Cell[CellGroupData[{
Cell[31268, 748, 637, 15, 73, "Input",
 CellID->2136589945],
Cell[31908, 765, 1090, 24, 39, "Output",
 CellID->484417948]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[33047, 795, 564, 10, 40, "MathCaption",
 CellID->1039735924],
Cell[33614, 807, 726, 23, 51, "Input",
 CellID->1502533949],
Cell[CellGroupData[{
Cell[34365, 834, 270, 7, 28, "Input",
 CellID->1929637448],
Cell[34638, 843, 1154, 29, 67, "Output",
 CellID->986531623]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[35841, 878, 593, 8, 40, "MathCaption",
 CellID->1489838555],
Cell[CellGroupData[{
Cell[36459, 890, 534, 14, 73, "Input",
 CellID->1204751577],
Cell[36996, 906, 184, 5, 26, "Output",
 CellID->1859847773]
}, Open  ]],
Cell[CellGroupData[{
Cell[37217, 916, 391, 11, 28, "Input",
 CellID->1337784427],
Cell[37611, 929, 6961, 181, 147, "Output",
 CellID->630000837]
}, Open  ]],
Cell[CellGroupData[{
Cell[44609, 1115, 250, 7, 28, "Input",
 CellID->2047027162],
Cell[44862, 1124, 204, 7, 26, "Output",
 CellID->191610120]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[45115, 1137, 65, 1, 74, "TutorialMoreAboutSection",
 CellID->23220180],
Cell[45183, 1140, 228, 4, 23, "TutorialMoreAbout",
 CellID->238287387]
}, Open  ]],
Cell[CellGroupData[{
Cell[45448, 1149, 114, 2, 74, "RelatedTutorialsSection",
 CellID->415694126],
Cell[45565, 1153, 52, 1, 23, "RelatedTutorials",
 CellID->806871991]
}, Open  ]],
Cell[CellGroupData[{
Cell[45654, 1159, 98, 1, 74, "TutorialRelatedLinksSection",
 CellID->415694148],
Cell[45755, 1162, 56, 1, 23, "TutorialRelatedLinks",
 CellID->415694149]
}, Open  ]]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
